home *** CD-ROM | disk | FTP | other *** search
/ CU Amiga Super CD-ROM 19 / CU Amiga Magazine's Super CD-ROM 19 (1998)(EMAP Images)(GB)[!][issue 1998-02].iso / CUCD / Programming / LEDA / prog / dict / p_dic.c < prev    next >
C/C++ Source or Header  |  1994-08-05  |  463b  |  32 lines

  1. #include <LEDA/p_dictionary.h>
  2. #include <LEDA/list.h>
  3. #include <math.h>
  4.  
  5.  
  6. typedef p_dictionary<float,string> PDIC;
  7.  
  8.  
  9. main()
  10. {
  11.   p_dictionary<float,string> Dic;
  12.  
  13.   list<PDIC>  L;
  14.  
  15.   int n = read_int("n = ");
  16.  
  17.  
  18.   for(int i = 1; i<n; i++) 
  19.   {  Dic = Dic.insert(sqrt(i),string("sqrt(%d)",i));
  20.      L.append(Dic);
  21.    }
  22.  
  23.  
  24.   forall(Dic,L) 
  25.   { p_dic_item it;
  26.     forall_items(it,Dic)  cout << Dic.inf(it) << "=" <<  Dic.key(it) << " ";
  27.     newline;
  28.    }
  29.  
  30.   return 0;
  31. }
  32.